package Main;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class MainFrame extends JFrame
{
	private Container container;
	private MainPanel mainPanel;
	
	
	public MainFrame()
	{
		super("VisuNote");

		setWindow(600,250);

		MyWindowListener listenerWindow = new MyWindowListener();
		this.addWindowListener(listenerWindow);
		
		// Panel
		mainPanel = new MainPanel(this);

		// Menu Bar
		// createMenuBar();

		// Container
		container = getContentPane();
		container.add(mainPanel,BorderLayout.CENTER);

		// Listeners
		// addListeners();

		setResizable(false); //Rend la frame non modifiable
		setVisible(true); //Rend la frame visible
	}
	
	private class MyWindowListener extends WindowAdapter
	{
		public void windowClosing(WindowEvent e)
		{
			System.exit(0);
		}
	}
	
	public void setWindow(int width, int height)
	{
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); //Get the screen size
    	setBounds((screenSize.width - width) / 2, (screenSize.height - height) / 2, width, height); //Set main window dimensions automatically in the center
	}
}
